package com.example.nacosConsumer.service;

import com.example.nacosConsumer.entity.Customer;
import com.example.nacosConsumer.fallback.ConsumerServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 调用服务提供者，同时指定服务降级工厂类
 */
@FeignClient(name = "service-provider", fallbackFactory = ConsumerServiceFallbackFactory.class)
public interface ConsumerService {

    @GetMapping("/helloProvider")
    String hello(@RequestParam("name") String name);

    @PostMapping("/helloProvider")
    String insertInfo(@RequestBody Customer customer);
}
